]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Make sure we only emit 'destroy' for a notification once
authorMarina Zhurakhinskaya <marinaz@redhat.com>
Sun, 30 Jan 2011 23:33:49 +0000 (18:33 -0500)
committerMarina Zhurakhinskaya <marinaz@redhat.com>
Sun, 30 Jan 2011 23:53:19 +0000 (18:53 -0500)
There are multiple code passes that can result in Notification::destroy()
being called, such as a notification being closed by the application
when it exits and the associated source being removed at the same time.
However, we should only emit 'destroy' for the notification and
do the associated work once.

js/ui/messageTray.js

index 81997df0607c2a72e4594e54949def53dd6da5fe..baa11f0d44e216138d7466ad8a3c6c80b42f5966 100644 (file)
@@ -254,6 +254,7 @@ Notification.prototype = {
         // 'transient' is a reserved keyword in JS, so we have to use an alternate variable name
         this.isTransient = false;
         this.expanded = false;
+        this._destroyed = false;
         this._useActionIcons = false;
         this._customContent = false;
         this._bannerBodyText = null;
@@ -771,6 +772,9 @@ Notification.prototype = {
     },
 
     destroy: function(reason) {
+        if (this._destroyed)
+            return;
+        this._destroyed = true;
         if (!reason)
             reason = NotificationDestroyedReason.DISMISSED;
         this.emit('destroy', reason);